﻿// see also http://stackoverflow.com/questions/15899009/avoid-conflicts-with-function-naming-conventions-javascript
// In general do not use global function/variables. Read about javascript module pattern here


/**
 * If you don't need access to those functions outside of your script 
 * you can wrap the whole script in an immediately invoked function expression
 **/
(function () {
    // Your code here
}());


/**
 * If you do need access outside of that scope, expose your functions as methods of a "namespace":
 * By taking this approach you only introduce a single global identifier, reducing the chances of a conflict.
 **/
var YourStuff = (function () {
    // Private functions etc...

    // Expose public methods
    return {
        someMethod: function () { }
    };
}());

YourStuff.someMethod();

// Use namespaces

var company = {};

company.doSomething = function () {
};

company.project = {};
company.project.submodule = {};
company.project.submodule.doSomething = function () { };